home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / disk / cdrom / MusicBox-2.1bi.lha / MusicBox / MusicBoxPrint.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-29  |  3.9 KB  |  111 lines

  1. /*
  2.  ##########################################################################
  3.  ####                                                                  ####
  4.  ####                        The MusicBox Project                      ####
  5.  ####                    ============================                  ####
  6.  ####                                                                  ####
  7.  #### MusicBoxPrint.c                                                  ####
  8.  ####                                                                  ####
  9.  #### Version 2.1os  --  September 29, 2000                            ####
  10.  ####                                                                  ####
  11.  #### Copyright (C) 1994  Thomas Dreibholz                             ####
  12.  ####               2000  Molbachweg 7                                 ####
  13.  ####                     51674 Wiehl                                  ####
  14.  ####                     Germany                                      ####
  15.  ####                                                                  ####
  16.  ####                     EMail: Dreibholz@bigfoot.com                 ####
  17.  ####                     WWW:   http://www.bigfoot.com/~dreibholz     ####
  18.  ####                                                                  ####
  19.  ##########################################################################
  20. */
  21. /***************************************************************************
  22.  *                                                                         *
  23.  *   This program is free software; you can redistribute it and/or modify  *
  24.  *   it under the terms of the GNU General Public License as published by  *
  25.  *   the Free Software Foundation; either version 2 of the License, or     *
  26.  *   (at your option) any later version.                                   *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30. /* MusicBox - Druckroutinen */
  31. #include "MusicBox.h"
  32.  
  33. extern struct Window  *KatalogWnd;
  34. extern struct Katalog *AuswahlK;
  35.  
  36. void SetupPrinter()
  37. {
  38.  struct TagItem              tag[5];
  39.  register struct FileHandle *con;
  40.  
  41.  con=Open("CON:10/20/620/150/Music Box/AUTO/WAIT/CLOSE",MODE_NEWFILE);
  42.  if(con!=NULL)
  43.   {
  44.    tag[0].ti_Tag=SYS_Input;
  45.    tag[0].ti_Data=NULL;
  46.    tag[1].ti_Tag=SYS_Output;
  47.    tag[1].ti_Data=con;
  48.    tag[2].ti_Tag=SYS_Asynch;
  49.    tag[2].ti_Data=TRUE;
  50.    tag[3].ti_Tag=SYS_UserShell;
  51.    tag[3].ti_Data=TRUE;
  52.    tag[4].ti_Tag=TAG_DONE;
  53.    SystemTagList("SYS:Prefs/Printer",&tag);
  54.   }
  55.  else
  56.    Error(GS(20,"Unable to open AutoCon-window!"));
  57. }
  58.  
  59. void PrintIt(win,cat)
  60.  struct Window  *win;
  61.  struct Katalog *cat;
  62. {
  63.  UBYTE                       text[100];
  64.  register long               i,m,s,f;
  65.  register struct FileHandle *fh;
  66.  
  67.  if(cat!=NULL)
  68.   {
  69.    i=MultiRequest(GS(502,"Print..."),
  70.                   GS(503,"Do you want to print the current catalog?"),
  71.                   GS(504,"Draft|Letter Quality|Abort"));
  72.    SleepPointer(win);
  73.    if(i!=0)
  74.     {
  75.      fh=Open("PRT:",MODE_NEWFILE);
  76.      if(fh!=NULL)
  77.       {
  78.        if(i==1)
  79.          strcpy(&text,"\x1b0\x1b#1\x1b[1\"z\x1bE\x1b[4m\x1b[1m");
  80.        else
  81.          strcpy(&text,"\x1b0\x1b#1\x1b[2\"z\x1bE\x1b[4m\x1b[1m");
  82.        Write(fh,&text,strlen(&text));
  83.        Write(fh,&cat->CDName,strlen(&cat->CDName));
  84.        sprintf(&text,"\n\n\x1b[24m\x1b[22m");
  85.        Write(fh,&text,strlen(&text));
  86.  
  87.        for(i=0;i<cat->Anzahl;i++)
  88.         {
  89.          m=cat->KE[i].TAdresse/75/60;
  90.          s=(cat->KE[i].TAdresse/75) % 60;
  91.          f=cat->KE[i].TAdresse % 75;
  92.          sprintf(&text,"\x1b[1m%02d\x1b[22m  %2ld:%02ld'%02ld  %s\n",i+1,m,s,f,&cat->KE[i].Titel);
  93.          Write(fh,&text,strlen(&text));
  94.         }
  95.  
  96.        Close(fh);
  97.       }
  98.      else
  99.        Error(GS(505,"Unable to open PRT:"));
  100.     }
  101.    ClearPointer(win);
  102.   }
  103.  else
  104.   {
  105.    MultiRequest(GS(502,"Print..."),
  106.                 GS(506,"Please select a CD before print!"),
  107.                 GS(507,"Okay"));
  108.   }
  109. }
  110.  
  111.